<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="vo.*,Dao.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
String good_name = request.getParameter("good_name");
String qty = request.getParameter("qty");
int qty2 = Integer.valueOf(qty);
String price = request.getParameter("good_price");
String type = request.getParameter("options");
String good_desc = request.getParameter("good_desc");
String good_pic = request.getParameter("good_pic");
int ispreferred = Integer.valueOf(type);
Goods go = new Goods();
go.setGood_name(good_name);
go.setGood_price(price);
go.setIspreferred(ispreferred);
go.setGood_desc(good_desc);
go.setGood_pic(good_pic);
go.setQty(qty2);
Gooddao dao = new Gooddao();
int result = dao.do_register(go);

if(result>0){
	%>
	<script type="text/javascript">
	window.alert("上架成功！");
	window.location.href="goos_fenlei.jsp";
	</script>
	<% 
}else{
	%>
	<script type="text/javascript">
	window.alert("上架失败！");
	window.location.href="shangjia.jsp";
	</script>
	<%
}

%>
</body>
</html>